//
// Copyright (c) 2024 BPer
//
#ifndef INCLUDE_BPERAVUTIL_VIDEO_BPERCNALU_H_
#define INCLUDE_BPERAVUTIL_VIDEO_BPERCNALU_H_

#include <bperutil/BPerType.h>
#include <bperutil/BPerAvType.h>
#include <stdint.h>

#define BPer_Nalu_SpsppsBufferLen 256

 typedef struct {
	int spsppsPos;
	int keyframePos;
}BPerH264NaluData;

 typedef struct {
	int spsPos;
	int ppsPos;
	int spsLen;
	int ppsLen;
	int keyframePos;
}BPerH264NaluData2;

int32_t bPer_parseH264Nalu(BPerFrame* videoFrame, BPerH264NaluData* pnalu);
int32_t bPer_parseH264Nalu2(BPerFrame* videoFrame, BPerH264NaluData2* pnalu);
int32_t bPer_getH264SpsppseNalu(BPerFrame* videoFrame,uint8_t* pnaludata);
int32_t bPer_getH264KeyframeNalu(BPerFrame* videoFrame);
BPerBool bPer_hasH264Pframe(uint8_t* p);

int32_t bPer_getH265SpsppseNalu(BPerFrame* videoFrame,uint8_t* pnaludata);
int32_t bPer_parseH265Nalu(BPerFrame* videoFrame,BPerH264NaluData* pnalu);

int32_t bPer_getNalupos(uint8_t* data,int plen);

#endif /* INCLUDE_BPERAVUTIL_VIDEO_BPERCNALU_H_ */
